
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<script type="text/javascript" src="${path }/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="${path }/js/form/jquery.form.js"></script>
<script type="text/javascript">
	$(document).ready(function() { 
			var options = {
				beforeSubmit: checkForm,
				dataType : 'json',
				success:addBack
			};
					
			$('#loginForm').ajaxForm(options); 
				    
	}); 
			
	function checkForm(){
		$("#info").html("正在登录..");
		//return false;
	}
			
	function addBack(json){
		if(json.result=="Success"){
			document.location = "/index";
		}else if(json.result == "Faile" && json.ErrorCode == "-1"){
			$("#info").html("用户不存在!");
		}else if(json.result == "Faile" && json.ErrorCode == "-2"){
			$("#info").html("密码错误!");	
		}
	}
	
	function openMyOrder(){
		var diag = new Dialog();
		diag.Width = 600;
		diag.Height = 550;
		diag.Title = "申请店铺";
		diag.URL = "/order/my/show";
		diag.show();
	}
</script>	
<div class="login_box">
	<c:if test="${member == null }">
			<h2 >会员登录</h2><span id="info"></span>
			<form action="/member/login" method="post" name="loginForm" id="loginForm">
				<table width="100%">
					<tr>
						<td>
							用户名:
						</td>
						<td>
							<input type="text" name="memberName" size="10">
						</td>
					</tr>
					<tr>
						<td>
							用户密码:
						</td>
						<td>
							<input type="password" name="memberPwd" size="10">
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<input type="submit" value="登录">
						</td>
					</tr>
				</table>
			</form>
	</c:if>
	<c:if test="${member != null }">
			<h2>欢迎你，${member.memberRealName }</h2>
			<div>
				<img src="/picture/show/${member.memberPhoto }" width="100px" height="100px"/>
			</div>
			<div class="funDiv">
				<span><a href="/member/logout"/>注销</a></span>
				<span>
					<c:if test="${myOrderTotal > 0 }">
						您有：<font color="red">${myOrderTotal}</font>个确认申请，请<a href="javascript:void(0)" onclick="openMyOrder()">查看</a>
					</c:if>
				</span>
			</div>
	</c:if>

</div>